﻿using System;
using DapperExtensions.Mapper;
using Newtonsoft.Json;

namespace ZilLion.Service.WeChatMall.Domain.Entitys.GsInfo
{
    public class OfflineGsEntity
    {
        /// <summary>
        ///     货品设置名称
        /// </summary>
        [JsonProperty("gsname")]
        public string GsName { get; set; }

        /// <summary>
        ///     货品id
        /// </summary>
        [JsonProperty("gsid")]
        public int Gsid { get; set; }

        /// <summary>
        ///     索引码
        /// </summary>
        [JsonProperty("gsindexcode")]
        public string GsIndexCode { get; set; }

        /// <summary>
        ///     是否禁用
        /// </summary>
        [JsonProperty("gsisforbidden")]
        public short GsIsForbidden { get; set; }
    }

    public class OfflineGsEntityMapper : ClassMapper<OfflineGsEntity>
    {
        public OfflineGsEntityMapper()
        {
            Table("waibkyhpa");
            Map(f => f.GsName).Column("hpszmc");
            Map(f => f.Gsid).Column("hpid").Key(KeyType.Assigned);
            Map(f => f.GsIndexCode).Column("hpsym");
            Map(f => f.GsIsForbidden).Column("hpisforbidden");
        }
    }

    public class OfflineGsRelationshipEntity
    {
        /// <summary>
        ///     商户ID（使用微信APPID作为商户ID）
        /// </summary>
        public string Zlcompanykey { get; set; }

        /// <summary>
        ///     货品id
        /// </summary>
        public long GsId { get; set; }

        /// <summary>
        ///     线下货品id
        /// </summary>
        public long OfflineGsId { get; set; }

        /// <summary>
        ///     修改时间
        /// </summary>
        public DateTime UpdatedTime { get; set; }

        /// <summary>
        ///     修改人
        /// </summary>
        public long Updater { get; set; }
    }

    public class OfflineGsRelationshipEntityMapper : ClassMapper<OfflineGsRelationshipEntity>
    {
        public OfflineGsRelationshipEntityMapper()
        {
            Table("offlinegsrelationship");
            Map(f => f.Zlcompanykey).Column("zlcompanykey").Key(KeyType.Assigned);
            Map(f => f.GsId).Column("gsid").Key(KeyType.Assigned);
            Map(f => f.OfflineGsId).Column("offlinegsid").Key(KeyType.Assigned);
            Map(f => f.UpdatedTime).Column("updatedtime");
            Map(f => f.Updater).Column("updater");
        }
    }
}